package com.bsuc.buglydemo;

import android.content.Context;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

import com.tencent.bugly.crashreport.CrashReport;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;

public class Main1Activity extends AppCompatActivity implements View.OnClickListener {

    @BindView(R.id.crash1)
    TextView crash1;
    private Unbinder unbinder;
    @BindView(R.id.null_pointer_exception)
    TextView null_pointer_exception;
    @BindView(R.id.bug)
    TextView bug;
    @BindView(R.id.update)
    TextView update;
    @BindView(R.id.hot_update)
    TextView hot_update;

    TextView t;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main2);
        unbinder = ButterKnife.bind(this);
        initView();
        initData();
    }

    @OnClick({R.id.crash1, R.id.null_pointer_exception, R.id.bug,R.id.update,R.id.hot_update})
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.crash1:
                CrashReport.testJavaCrash();
                break;
            case R.id.null_pointer_exception:
                t.setText("其实t是空的！");
                break;
            case R.id.bug:
                int a=5/0;
                break;
            case R.id.update:
                Toast toast = Toast.makeText(getApplicationContext(), null, Toast.LENGTH_SHORT);
                toast.setText("已经通过bugly更新了app啦");
                toast.show();
                break;
            case R.id.hot_update:
                String s = null;
                System.out.println(s);
                break;
            default:
                break;
        }
    }

    private void initView() {

    }

    private void initData() {

    }
}
